 /* UVa- 706
 * Author- Ajeet Singh
 * http://uva.onlinejudge.org
 * id- ajeet.singh82
 * Contact- ajeet.singh82@gmail.com
 *
 * 
 * Algorithm: 
 *
 *
 * Build:
 * ...
 */
#include <iostream>
#include <string>
#include <sstream>
#include <stdio.h>
#include <map>
using namespace std;
typedef pair<short, short> param;
typedef pair<short, param> key;
typedef pair<key, string> hash_param;
typedef map<key, string> hash;
hash table;
char number[20];

string line[10][5] = {
	{" - ", "| |", "   ", "| |", " - "}, //0
	{"   ", "  |", "   ", "  |", "   "}, //1
	{" - ", "  |", " - ", "|  ", " - "}, //2
	{" - ", "  |", " - ", "  |", " - "}, //3
	{"   ", "| |", " - ", "  |", "   "}, //4
	{" - ", "|  ", " - ", "  |", " - "}, //5
	{" - ", "|  ", " - ", "| |", " - "}, //6
	{" - ", "  |", "   ", "  |", "   "}, //7
	{" - ", "| |", " - ", "| |", " - "}, //8
	{" - ", "| |", " - ", "  |", " - "} //9
};
string* table[10][10][5]
void prepare_dc(short size, string& str) {
	for(short l = 0; l<5; l++) {
		string r;
		short i = 0;
		short sz = size;
		while(number[i] != '\0') {
			param p(((short)number[i])-48, l);
			key k(size, p);
			r += table[k];
			if(number[i+1] != '\0')
				r += " ";
			i++;
		}
		str += r + '\n';
		sz--;
		while ((l & 0x01) != 0 && sz > 0 ) {
			str += r + '\n';
			sz--;
		}
	}
}

void hash_lines(string& value, short l, short ss, short num) {
	value += line[num][l].at(0);
	value.append(ss, line[num][l].at(1));
	value += line[num][l].at(2);
}
void init_hash() {
	for (short s=1; s <= 10; s++) {
		for (short num = 0; num <= 9; num++) {
			for(short l= 0; l < 5; l++) {
				string value;
				hash_lines(value, l, s, num);
				param p(num, l);
				key k(s, p);
				hash_param v(k, value);
				table.insert(v);
			}
		}
	}

}

/* main
 * */

int main() {
	init_hash();
	while ( true ) {
		unsigned long n =0;
		short size = 0;
		fill(number, number+10, '\0');
		cin >> size >> n;
		if (size == 0) { 
			return 0;
		}
		sprintf(number, "%lu", n);
		string str;
		prepare_dc(size, str);
		cout << str <<  endl;
	}
}
